<!--
 * @Author: zqx me_zqx@163.com
 * @Date: 2025-05-15 14:39:00
 * @LastEditors: zqx me_zqx@163.com
 * @LastEditTime: 2025-05-15 14:46:46
 * @FilePath: /XMate-h5/src/views/minutes/components/commonError/ErrorView.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="error-page">
    <van-empty image="error" :description="errorMessage">
      <van-button
        v-if="needLogin"
        class="confirmBtn"
        color="#436BFF"
        round
        type="success"
        @click="pushLogin"
      >
        前往登录
      </van-button>
    </van-empty>
  </div>
</template>

<script setup lang="ts">
import { defineProps } from "vue";
import { baseWebUrl, loginWebUrl } from "@/utils/urlTool";

defineProps({
  errorMessage: {
    type: String,
    default: "暂无数据"
  },
  needLogin: {
    type: Boolean,
    default: false
  }
});

function pushLogin() {
  let returnUrl = `${baseWebUrl()}/postmeet-xmate-h5/thirdLogin.html`;
  let loginUrl = loginWebUrl();
  const proCode = "nova_guide";
  let url = `${loginUrl}?platform=1&productCode=${proCode}&redirectUrl=${returnUrl}`;
  localStorage.setItem("yxt-minutes-url", window.location.href);
  //   window.open(url, "_blank");
  window.location.replace(url);
}
</script>

<style>
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  text-align: center;
  font-size: 24px;
}

.error-page h1 {
  font-size: 48px;
  margin-bottom: 20px;
}

.error-page button {
  padding: 10px 20px;
  font-size: 18px;
}

.confirmBtn {
  width: 120px;
  height: 40px;
  margin-top: 24px;
}
</style>
